/**
 * Created by chris on 2017/7/4.
 */
import {Injectable} from '@angular/core';
import {AppVersion} from "@ionic-native/app-version";
import {AppUpdate} from "@ionic-native/app-update";
import {BarcodeScanner} from "@ionic-native/barcode-scanner";

@Injectable()
export class NativeProvider {

    updateUrl: string = 'http://core.henglixuantz.com/android_update.xml';

    constructor(private appVersion: AppVersion,
                private appUpdate: AppUpdate,
                private barcodeScanner: BarcodeScanner) {
    }

    getAppVersionNumber() {
        return this.appVersion.getVersionNumber();
    }

    getAppVersionCode() {
        return this.appVersion.getVersionCode();
    }

    checkAppUpdate() {
        return this.appUpdate.checkAppUpdate(this.updateUrl);
    }

    barCodeScan(option: any) {
        return this.barcodeScanner.scan(option);
    }
}